#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QIcon>
#include <QSystemTrayIcon>
#include <QCloseEvent>
#include <QMenu>
#include <QAction>
#include <QDebug>
#include <QGridLayout>
#include <QLabel>

//#include "imagedialog.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
/**
 * @brief The MainWindow class
 *
 */
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    auto const inline static STR_RELOAD = "重新加载";
    auto const inline static STR_ADD_NEW = "新图片";
    auto const inline static STR_CLOSE = "关闭主窗体";
    auto const inline static STR_QUIT = "退出";
    auto const inline static STR_SHOW_MAIN_WIN = "主窗体";

private slots:
    void quitApp();
//    void on_btnSave_clicked();
    void doReloadAction();
    void doAddNewAction();
    void doCloseAction();
    void doshowMainWinAction();
    void onImageChange();
private:
    Ui::MainWindow *ui;
//    QSystemTrayIcon *trayIcon;
    QSystemTrayIcon trayIcon;//托盘图标
    QMenu* trayIconMenu;
    QAction* quitAction;
    QAction* reloadAction;
    QAction* addNewAction;
    QAction* closeAction;
    QAction* showMainWinAction;

    QGridLayout* layout;
    const int COUNT_PER_ROW = 3;

    void initMenu();
    void initDialog();
    void createLabel(QString imgFile, QString id, int num=-1);

protected:
    void closeEvent(QCloseEvent *event);
};
#endif // MAINWINDOW_H
